/**
 * Framework for batch testing user profile models
 * Final project by Sergey Nepomnyachiy and Julia Polchin
 * Supervisor: Tsvi Kuflik
 *
 */
package core.generators;

import java.util.Random;

/**
 * Generates random integers in given range
 * 
 * @author Sergey&Julia
 * 
 */
public class RandomIntRangeGenerator extends FunctionGenerator<Integer> {

	private Random rnd;
	private final Integer right;

	/**
	 * Random integers in range constructor
	 * 
	 * @param left
	 *            minimum in given range
	 * @param right
	 *            maximum in given range
	 * @param count
	 *            how many values to generate
	 * @param seed
	 *            initialize the pseudo-random number generator with it
	 */
	public RandomIntRangeGenerator(Integer left, Integer right, int count,
			long seed) {
		super(left);
		this.rnd = new Random(seed);
		this.right = right;
		generate(count);
	}

	@SuppressWarnings("boxing")
	@Override
	Integer function(int index) {
		return this.rnd.nextInt(this.right - this.start) + this.start;

	}

}
